<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>艾家艾产品线上销售平台</title>
    <link rel="shortcut icon" href="../img/favicon.ico">
    <link rel="stylesheet" href="../css/reset.css"/>
    <link rel="stylesheet" href="../css/register.css"/>
    <script src="../them/jquery/jquery-1.7.2.js"></script>
    <script src="../them/jquery/jquery.cookie.js"></script>
</head>
<body>
<div class="box">
    <div class="header">
        <div class="header-logo">
            <div class="logo_b"></div>
            <div class="tittle">
                <p style="font-size: 32px;margin-bottom: 25px">重置密码</p>
            </div>
        </div>
    </div>

    <div class="regbox">
        <p class="look">请输入用户名</p>
        <form method="post" >
            <input type="text" name="use" placeholder="请输入用户名" style="width: 334px;" id="phone">
            <p class="hint phone-text"></p>
        </form>
        <p class="btn">下一步</p>
    </div>
</div>

<div class="footer">
    <div class="footer-are">
        <a href="javascript:;">简体</a>
        <span> | </span>
        <a href="javascript:;">繁体</a>
        <span> | </span>
        <a href="javascript:;">English</a>
        <span> | </span>
        <a href="javascript:;">常见问题</a>
    </div>
    <div class="footer-info">
        <p>艾家艾草公司版权所有-京ICP备10046444-京公网安备11010802020134号-京ICP证110507号</p>
    </div>
</div>
</body>
</html>
<script>
    $('#phone').focus();
    $('#phone').blur(function(){
        if($(this).val()==''){
            $('.phone-text').html('用户名不能为空');
        }else{
            $('.phone-text').html('');
        }
    });
    $('.btn').click(function(){
        var name=$('#phone').val();
        $.ajax({
            url:'/user/forget_get_question.do',
            data:{
                'username':name
            },
            type:'post',
            success:function(res){
                console.log(res);
                if(res.status){
                    $('.phone-text').html(res.msg);
                }else{
                    var user_question=res.data;
                    var user_name=name;
                    var cookietime = new Date();
                    var date = new Date();
                    cookietime.setTime(date.getTime() + (10 * 60 * 1000));//coockie保存10分钟
                    $.cookie("user_question", user_question,{expires:cookietime});
                    $.cookie("user_name", user_name,{expires:cookietime});
                    window.location.href = "reset-msg.html";
                }
            },
            error:function(){

            }
        });
    });
</script>